#define _CRT_SECURE_NO_WARNINGS 1

#include"heap.h"
void testHeap1()
{
	int arr[] = { 12,3,34,54,23,24,66,10,29,30,49 };
	Heap ph;
	HeapInit(&ph);
	for (int i = 0; i < sizeof(arr) / sizeof(int); i++)
	{
		/*printf("%d %d \n", i, arr[i]);*/
		HeapPush(&ph, arr[i]);
		HeapPrint(&ph);
		printf("size:%d\n", HeapSize(&ph));
	}
	for (int i = 0; i < sizeof(arr) / sizeof(int); i++)
	{
		/*printf("%d %d \n", i, arr[i]);*/
		HeapPop(&ph);
		HeapPrint(&ph);
		printf("size:%d\n", HeapSize(&ph));
	}
}
void testHeap2()
{
	int arr[] = { 12,3,34,54,23,24,66,10,29,30,49 };
	Heap ph;
	//HeapCreate1(&ph,arr,sizeof(arr)/sizeof(arr[0]));
	HeapCreate2(&ph,arr,sizeof(arr)/sizeof(arr[0]));
	HeapPrint(&ph);
}
void testHeap3()
{
	int arr[] = { 12,3,34,54,23,24,66,10,29,30,49 };
	Heapsort(arr, sizeof(arr) / sizeof(arr[0]));
	for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		printf("%d ", arr[i]);
	}
}

void testHeap4()
{
	int arr[] = { 12,1012,3920,3,34,54,23,1082,24,66,10,29,30,49 };
	PrintTopK1(arr, sizeof(arr) / sizeof(arr[0]) ,4);

}

void testHeap5()
{
	
	PrintTopK2("a.txt", 100000, 6);
}
int main()
{
	//testHeap1();
	//testHeap2();
	//testHeap3();
	//testHeap4();
	srand((unsigned int)time(NULL));
	testHeap5();
	return 0;
}